package com.qf.Service.impl;

import com.qf.Dao.MedicineInfoDao;
import com.qf.Dao.impl.MedicineInfoDaoImpl;
import com.qf.Service.MedicineInfoService;
import com.qf.entity.MedicineInfo;

import java.sql.SQLException;

public class MedicineInfoServiceImpl implements MedicineInfoService {
    private MedicineInfoDao medicineInfoDao =new MedicineInfoDaoImpl();
    @Override
    public int addMedicineInfo(MedicineInfo medicineInfo) {

        try {
            int num= medicineInfoDao.addMedicineInfo(medicineInfo);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return -1;
    }

    @Override
    public int updateMedicineInfo(MedicineInfo medicineInfo)  {
        try {
            int num = medicineInfoDao.updateMedicineInfo(medicineInfo);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return -1;

    }

    @Override
    public int deleteMedicineInfo(int id)  {
        try {
            int num = medicineInfoDao.deleteMedicineInfo(id);
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return -1;
    }

    @Override
    public MedicineInfo selectByMedicine_name(String medicine_name) {


        try {
            return  medicineInfoDao.selectByMedicine_name(medicine_name);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
